﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace weighing
{
    internal class ScaleNameConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if(value == null ) return "未知";
            long scaleId =(long)value;
            var list = ScaleDao.Instance.GetList();
            string res = "未知";
            for (int i = 0; i < list.Count; i++)
            {
                if(scaleId == list[i].id)
                {
                    res = list[i].name;
                    break;
                }
            }
            return res;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
